package wait.notify.five.container.size;

import java.util.concurrent.TimeUnit;

public class Consumer2 implements Runnable {

	private MyContainer myContainer=null;
	
	
	public Consumer2(MyContainer myContainer) {
		super();
		this.myContainer = myContainer;
	}
	
	public void run() {
		while(true){
//			if(myContainer.getContainer().size()>0){
				for(Integer tempI:myContainer.getContainer()){
					System.out.println(Thread.currentThread().getName()+"^_^Has Get"+tempI);
					myContainer.getContainer().remove(0);//遍历一个，移走一个
				}
				try {
					TimeUnit.MICROSECONDS.sleep(100);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
//			}
		}
	}

}
